UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'GzBdR3Pj6+BrWNX1ba7JNMAmy+8F+o9POYXia871HZk=' 
WHERE 
  key_id = '0cbd7d4be801fd20c29337609223c2ded5c18695658a8aad1a1b863fb4975880' 
  AND (
    token = 'GzBdR3Pj6+BrWNX1ba7JNMAmy+8F+o9POYXia871HZk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023