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