UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bm/VY80gwU+cTk7Ai5zVrcZk5k+KU0WdsoYA6ELEABQ=' 
WHERE 
  key_id = '76d5053e1c0143344dec3c0c1a319c1a44d7a9c7fae66f6da11cfe021a5d6023' 
  AND (
    token = 'Bm/VY80gwU+cTk7Ai5zVrcZk5k+KU0WdsoYA6ELEABQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00022