UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'uXYXiHsykKvr1Wg6gpATtZn613MIoy71u2a2hsqD6OI='
WHERE
key_id = 'd351b71f1a213dfff6f19fc630bacc2ff572425846318a6f2085ff11f67c0029'
AND (
token = 'uXYXiHsykKvr1Wg6gpATtZn613MIoy71u2a2hsqD6OI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)