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