UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '3es1oja8IbYlHilkvOXOX5FzZ7HYjb8ku9Gt8L00bLo='
WHERE
key_id = 'e554210e4888d1c0192659afb59c97035a55369ed01680f3fba61386df29f118'
AND (
token = '3es1oja8IbYlHilkvOXOX5FzZ7HYjb8ku9Gt8L00bLo='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)