UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'R0XIXDB6pA9x37GtHTc6X4ttDT9NJ30rh0dwkg+t8gs='
WHERE
key_id = 'a225f2c2f2eba4a374b44cc39743adca412eeb79a7eae00b1df9156f84164f4f'
AND (
token = 'R0XIXDB6pA9x37GtHTc6X4ttDT9NJ30rh0dwkg+t8gs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)