UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'aH2WAiOAviIgYPJuDsxKXS/cLUVN2ndchs5/fy6kVwQ=' 
WHERE 
  key_id = '7d0d24e63ec9aaf5a5e743640c6abbca1ff652fe0781ff1d8d8335f6db46dbbc' 
  AND (
    token = 'aH2WAiOAviIgYPJuDsxKXS/cLUVN2ndchs5/fy6kVwQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026