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