UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NtdYOIZaRrNdNIK4PN4cKgGzntO52EH/s9y+ZFKBDEw=' 
WHERE 
  key_id = '0bb09a14651d22de26cb6c0f2a8c714498fc00790d570b8f00502b786f3d28f9' 
  AND (
    token = 'NtdYOIZaRrNdNIK4PN4cKgGzntO52EH/s9y+ZFKBDEw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030