UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'fy5i9jpliAkPkJqlTiXx8pZrUshtqkPxiBx5y2U//qY='
WHERE
key_id = 'fdde1b83a90c0ec3a6ba716809c55b4e1cd69a7cfe978c268710f7a55e4f6c3a'
AND (
token = 'fy5i9jpliAkPkJqlTiXx8pZrUshtqkPxiBx5y2U//qY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)