UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'qtlsb547aB7VxbFgSLszLg5okDKJfMvud0Y1+nGL14E='
WHERE
key_id = '6da1b239c5132b999660b328e64bb5ce038b96f17fe8a5a3e4ba55a3a5e3bacd'
AND (
token = 'qtlsb547aB7VxbFgSLszLg5okDKJfMvud0Y1+nGL14E='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)