UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'FZRTD+kfE+PV5Zxm0ZIWZC8jh4AhpIhq+hrymGdKHkQ=' 
WHERE 
  key_id = 'd9cff47969f0713202dd0964d060655083df534aeb83b6c33dd452dfacc443bc' 
  AND (
    token = 'FZRTD+kfE+PV5Zxm0ZIWZC8jh4AhpIhq+hrymGdKHkQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041