UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'r52gU27hi1KAdxmlZaP3RM0xRz4httPALxz5uZJzcHE='
WHERE
key_id = '517594b5569ae730fdd9ecbf46328dff918485fc09ded089bfff85f62f551a42'
AND (
token = 'r52gU27hi1KAdxmlZaP3RM0xRz4httPALxz5uZJzcHE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)