UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dt4id8SCSldDMI0AC8MgmpZJbTrF7MScSN+oLT9SAdk='
WHERE
key_id = '087636547c3cd4f17974ed3c3df6e29af1805e9b9e7ab062fae13d571526c71c'
AND (
token = 'dt4id8SCSldDMI0AC8MgmpZJbTrF7MScSN+oLT9SAdk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)