UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'b4kegq8q4Hi1okgP8fPZ1yqH5KXFfrtr3oswV+ZxkZI=' 
WHERE 
  key_id = 'e67c0edacffe42326591ec56bde7a4b05dad8e0f43d3b4295ec6c961223d8ef4' 
  AND (
    token = 'b4kegq8q4Hi1okgP8fPZ1yqH5KXFfrtr3oswV+ZxkZI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029