UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Bd6jRDGBiJYXAcq+tmbdR34ugyVgdUkDp9+u2iQZ1Qg=' 
WHERE 
  key_id = 'aa5c2e50a108f8434e4eaae05eb0703154012d7ff5496443ce40669c367826b4' 
  AND (
    token = 'Bd6jRDGBiJYXAcq+tmbdR34ugyVgdUkDp9+u2iQZ1Qg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043