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