UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4ugl5x4i9bbbgCZLGl66l7vg+Fy42cFnx611TpjcfNg=' 
WHERE 
  key_id = '5355d4fbc6a95187f7a15b533adfadb903917d6a654a3f6d752318b765ee0068' 
  AND (
    token = '4ugl5x4i9bbbgCZLGl66l7vg+Fy42cFnx611TpjcfNg=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036