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