UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gz60Qo8CZvlsQI9XkMuNzhpNv1KSaYSdyq6k7bx9nSE=' 
WHERE 
  key_id = 'baadd47f05adff0be13598a10d49bd3d5b5dfd4fe2e6082193867ecb54ef1d0d' 
  AND (
    token = 'gz60Qo8CZvlsQI9XkMuNzhpNv1KSaYSdyq6k7bx9nSE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046