UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6uhU4UHRx4dH5lEUFaTFYIy2EL+7edAeeRxehgwzehY=' 
WHERE 
  key_id = '58e89fd2defc08e00d6a2f18af05b1c9ddb762fc7f6020dba228f0c7b55bce8d' 
  AND (
    token = '6uhU4UHRx4dH5lEUFaTFYIy2EL+7edAeeRxehgwzehY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034