UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'gRYasox41sW5VaXSJiuAFHrp0Q/9KZXkzn4TTghdP00=' 
WHERE 
  key_id = '192a4a06a62d37766925199caf0b55e449e2bd7b0e3768c7841fc8b1465df43f' 
  AND (
    token = 'gRYasox41sW5VaXSJiuAFHrp0Q/9KZXkzn4TTghdP00=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034