UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '+C5GXbD6HZ8ZK1a6slVFDXybMmmJHoUjVjiCUEHcj+g='
WHERE
key_id = 'b4943d13f611fda95c064a8e08181143cbf3ef3d89a18f0b475babce926b5fbf'
AND (
token = '+C5GXbD6HZ8ZK1a6slVFDXybMmmJHoUjVjiCUEHcj+g='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)