UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5KgcZWwibvNyui6CAj35npa8g6h9ODfthtmG01na/NE='
WHERE
key_id = '04667f0285d91bb0ee1ef77c5b3c89a390ba915f7788b18f3dc2b28b92e3da7b'
AND (
token = '5KgcZWwibvNyui6CAj35npa8g6h9ODfthtmG01na/NE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)