UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N3lYBZP9InLjpgFL30PhxcX863mXMZsZqo5+bTmld/w='
WHERE
key_id = 'ecea80aedac864bca989001f42fada0c78b854c3c6fb6be82efc0d4d8af0ea07'
AND (
token = 'N3lYBZP9InLjpgFL30PhxcX863mXMZsZqo5+bTmld/w='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)