UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gRMT5hYn2x7cuPu74q8OZKqUSbmSUaHgF28b2bdfD0o='
WHERE
key_id = '449272bcd855422c7605d600a3620ff47263b9ebc5806873305f9ecfdd6af8f4'
AND (
token = 'gRMT5hYn2x7cuPu74q8OZKqUSbmSUaHgF28b2bdfD0o='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)