UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hO38TnxirWUOQ4zOr6Vn1ci6ba1OCXTrLoTzDVd7j5E='
WHERE
key_id = '50c0c3d94bb619ccbe7939165acf9c189e4dd05312e2e85b3f952e4d1dc57b7c'
AND (
token = 'hO38TnxirWUOQ4zOr6Vn1ci6ba1OCXTrLoTzDVd7j5E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)