UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Zj6ooHWDDdFwmLn5Eyx5t1NRgrUlxysMIS4L5EJWro0='
WHERE
key_id = '7aacd71f18386409ba9c032988531250ce056d4d1776334bccef6769dae08197'
AND (
token = 'Zj6ooHWDDdFwmLn5Eyx5t1NRgrUlxysMIS4L5EJWro0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)