UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vkutDA/cKo+z23+qCePPg2Yyuk9MIhNRdxx/5Hqh4LA=' 
WHERE 
  key_id = '939e21cd85054111b379df5184ab050d1aed1e379cfdb45f05ca9873b8ba794b' 
  AND (
    token = 'vkutDA/cKo+z23+qCePPg2Yyuk9MIhNRdxx/5Hqh4LA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00054