UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xCsqSSqvONshg2mZyiVUKBc96PbRh8dIyzp8Wudf+ks='
WHERE
key_id = '5ead4506a71cc4e6f61e3313bca7fc0b809637299897683761deecdbaffd0360'
AND (
token = 'xCsqSSqvONshg2mZyiVUKBc96PbRh8dIyzp8Wudf+ks='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)