UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Nc+Ng+f1icgPEsTTb3dSOR9t+nY35sXaoybQ1viX8Co=' 
WHERE 
  key_id = '8bc80410d44efca8aac8d789af799cc7f98867c549b52e6f45a43d8d4c246d5d' 
  AND (
    token = 'Nc+Ng+f1icgPEsTTb3dSOR9t+nY35sXaoybQ1viX8Co=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034